<script>
export default {
  methods: {
    valid() {
      return new Promise((resolve, reject) => {
        if (!this.text) {
          reject(new Error('请输入姓名'))
        } else if (!this.text.match('^[\u4E00-\u9FA5]{2,5}$')) {
          reject(new Error('姓名格式为2-5个中文'))
        } else {
          resolve(this.text)
        }
      })
    }
  }
}
</script>
